﻿namespace Ross.EntityFramework.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class addEntitys : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.CourseClass",
                c => new
                    {
                        ID = c.Long(nullable: false, identity: true),
                        ClassName = c.String(nullable: false, maxLength: 50),
                        ClassIndex = c.String(nullable: false),
                        ParentID = c.String(maxLength: 50),
                        Lev = c.Int(nullable: false),
                        CommentText = c.String(),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.Course",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        Title = c.String(nullable: false, maxLength: 50),
                        Intro = c.String(nullable: false, maxLength: 500),
                        Rate = c.Int(nullable: false),
                        ClassID = c.Int(nullable: false),
                        CType = c.String(maxLength: 8),
                        VedioURL = c.String(maxLength: 500),
                        ImgURL = c.String(maxLength: 500),
                        FileURL = c.String(maxLength: 500),
                        InActive = c.Boolean(nullable: false),
                        Contents = c.String(),
                        UserID = c.Int(nullable: false),
                        UserName = c.String(nullable: false, maxLength: 20),
                        SignNum = c.Int(nullable: false),
                        CreateTime = c.DateTime(nullable: false),
                        EndTime = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.Courseware",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        FileURL = c.String(nullable: false, maxLength: 500),
                        Title = c.String(nullable: false, maxLength: 50),
                        DocType = c.String(maxLength: 10),
                        CourseID = c.Long(nullable: false),
                        CreateTime = c.DateTime(nullable: false),
                        Author = c.String(),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.ExamDB",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        ExamTitle = c.String(nullable: false, maxLength: 50),
                        ExamContent = c.String(),
                        UserID = c.Long(nullable: false),
                        IsClosed = c.Boolean(nullable: false),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.FAQs",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        AskTitle = c.String(nullable: false, maxLength: 50),
                        AskTime = c.DateTime(nullable: false),
                        AskContent = c.String(),
                        AnswerContent = c.String(),
                        UserID = c.Long(nullable: false),
                        IsClosed = c.Boolean(nullable: false),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.Notes",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        Contents = c.String(nullable: false),
                        CourseID = c.Long(nullable: false),
                        CreateTime = c.DateTime(nullable: false),
                        UserID = c.Long(nullable: false),
                    })
                .PrimaryKey(t => t.ID);
            
        }
        
        public override void Down()
        {
            DropTable("dbo.Notes");
            DropTable("dbo.FAQs");
            DropTable("dbo.ExamDB");
            DropTable("dbo.Courseware");
            DropTable("dbo.Course");
            DropTable("dbo.CourseClass");
        }
    }
}
